package com.Pan.confog;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @Description: Oss client
 * @Author: zhangjie
 * @Date: 26/12/18 PM2:21
 */
@Configuration
public class OSSConfig {

    @Value("${cloudStorage.aliyunOSS.endpoint}")
    private String endpoint;

    @Value("${cloudStorage.aliyunOSS.accessKeyId}")
    private String accessKeyId;

    @Value("${cloudStorage.aliyunOSS.accessKeySecret}")
    private String accessKeySecret;

    @Value("${cloudStorage.aliyunOSS.bucketName}")
    private String bucketName;

    @Bean
    OSS ossClient() {
        return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
    }
}
